// Just have to get this off my chest.

#include <cmath>
#include <iostream.h>

class Point {
	public:
		Point();
		Point(float x, float y);
		Point(const Point &);
		~Point();
		float GetX() const { return *pnX; }
		float GetY() const { return *pnY; }
		void SetX(float x) { *pnX = x; }
		void SetY(float y) { *pnY = y; }
		void Move(float x, float y);
		Point operator=(const Point &);
		Point operator+(const Point &);
		Point operator-(const Point &);
	private:
		float * pnX;
		float * pnY;
};

Point::Point() {
	pnX = new float(0);
	pnY = new float(0);
}

Point::Point(float x, float y) {
	pnX = new float(x);
	pnY = new float(y);
}

Point::Point(const Point & pt) {
	pnX = new float(pt.GetX());
	pnY = new float(pt.GetY());
}

Point::~Point() {
	delete pnX;
	delete pnY;
}

void Point::Move(float x, float y) {
	SetX(x);
	SetY(y);
}

Point Point::operator=(const Point & rhs) {
	if(this == &rhs)
		return *this;
	delete pnX;
	delete pnY;
	pnX = new float;
	pnY = new float;
	*pnX = rhs.GetX();
	*pnY = rhs.GetY();
	return *this;
}

Point Point::operator+(const Point & rhs) {
	return Point(GetX()+rhs.GetX(),GetY()+rhs.GetY());
}

Point Point::operator-(const Point & rhs) {
	return Point(GetX()-rhs.GetX(), GetY()-rhs.GetY());
}

class Vector {
	public:
		Vector();
		Vector(float angle, float length);
		Vector(const Vector &);
		Vector(const Point &);
		Vector(const Point &, const Point &);
		~Vector();
		float GetAngle() const { return *pfAngle; }
		float GetLength() const { return *pfLength; }
		void SetAngle(float angle) { *pfAngle = angle; }
		void SetLength(float length) { *pfLength = length; }
		void Rotate(float angle) { *pfAngle = (*pfAngle)+angle; }
		void Scale(float scalar) { *pfLength = (*pfLength)*scalar; }
		Vector operator=(const Vector &);
		Vector operator+(float rotation);
		Vector operator*(float scalar) { return Vector(*pfAngle,*pfLength*scalar); }
		Point operator+ (const Point &);
		Vector operator+(Vector &);		
	private:
		float * pfAngle;
		float * pfLength;
};

Vector::Vector() {
	pfAngle = new float(0);
	pfLength = new float(0);
}

Vector::Vector(float angle, float length) {
	pfAngle = new float(angle);
	pfLength = new float(length);
}

Vector::Vector(const Vector & vt) {
	pfAngle = new float(vt.GetAngle());
	pfLength = new float(vt.GetLength());
}

Vector::Vector(const Point & pt) {
	pfAngle = new float;
	pfLength = new float;
	*pfAngle = atan2((pt.GetY()), (pt.GetX()));
	*pfLength = sqrt(pt.GetY()*(pt.GetY())+pt.GetX()*(pt.GetX()));
}

Vector::Vector(const Point & pt1, const Point & pt2) {
	pfAngle = new float;
	pfLength = new float;
	*pfAngle = atan2(pt2.GetY()-pt1.GetY(), pt2.GetX()-pt1.GetX());
	*pfLength = sqrt((pt2.GetY()-pt1.GetY())*(pt2.GetY()-pt1.GetY())+
	                 (pt2.GetX()-pt1.GetX())*(pt2.GetX()-pt1.GetX()));
}


Vector::~Vector() {
	delete pfAngle;
	delete pfLength;
}

Vector Vector::operator=(const Vector & rhs) {
	if(this == &rhs)
		return *this;
	delete pfAngle;
	delete pfLength;
	pfAngle = new float;
	pfLength = new float;
	*pfAngle = rhs.GetAngle();
	*pfLength = rhs.GetLength();
	return *this;
}

Vector Vector::operator+(float rotation) {
	return Vector(*pfAngle+rotation,*pfLength);
}

Point Vector::operator+ (const Point & pt) {
	cout << (*pfLength) * cos(*pfAngle) << endl;
	cout << (*pfLength) * sin(*pfAngle) << endl;
	return Point((*pfLength) * cos(*pfAngle), (*pfLength) * sin(*pfAngle));
}

Vector Vector::operator+ (Vector & rhs) {
	Point origin(0,0);
	Point plhs, prhs;
	plhs = (*this)+origin;
	prhs = (rhs)+origin;
	return Vector(plhs+prhs);
}
/*
class Line {
	public:
		Line();
		Line(Point end1, Point end2);
		Line(Point end1, Vector vector);
		~Line();
		Point GetEndPoint1() const { return *pEndPoint1; }
		Point GetEndPoint2() const { return *pEndPoint2; }
		Vector GetVector() const { return *pVector; }
		void SetEndPoint1(Point end1) { pEndPoint1->Move(end1.GetX, end1.GetY); }
		void SetEndPoint2(Point end2) { pEndPoint2->Move(end2.GetX, end2.GetY); }
		
	*/	



int main(){
	Point dot;
	Point dot2(3,4);
	cout << "dot x: " << dot.GetX() << endl;
	cout << "dot y: " << dot.GetY() << endl;
	//cout << "dot2 x: " << dot2.GetX() << endl;
	//cout << "dot2 y: " << dot2.GetY() << endl;
	cout << "dot.Move(5,6)" << endl;
	dot.Move(5,6);
	cout << "dot x: " << dot.GetX() << endl;
	cout << "dot y: " << dot.GetY() << endl;
	Vector vect(dot);
	cout << "vect angle: " << vect.GetAngle() << endl;
	cout << "vect length: " << vect.GetLength() << endl;
	Point origin;
	dot = vect+origin;
	cout << "dot = vect+origin" << endl;
	cout << "dot x: " << dot.GetX() << endl;
	cout << "dot y: " << dot.GetY() << endl;
	return 0;
}
